Integrand size = 45, antiderivative size = 417 \[ \int \frac {(a+b \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=-\frac {\left (a^2 \left (c^2 C-2 B c d-C d^2-A \left (c^2-d^2\right )\right )-b^2 \left (c^2 C-2 B c d-C d^2-A \left (c^2-d^2\right )\right )-2 a b \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) x}{\left (c^2+d^2\right )^2}+\frac {\left (2 a b \left (c^2 C-2 B c d-C d^2-A \left (c^2-d^2\right )\right )+a^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )-b^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) \log (\cos (e+f x))}{\left (c^2+d^2\right )^2 f}-\frac {(b c-a d) \left (b \left (2 c^4 C-B c^3 d+4 c^2 C d^2-3 B c d^3+2 A d^4\right )+a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) \log (c+d \tan (e+f x))}{d^3 \left (c^2+d^2\right )^2 f}+\frac {b^2 \left (2 c^2 C-B c d+(A+C) d^2\right ) \tan (e+f x)}{d^2 \left (c^2+d^2\right ) f}-\frac {\left (c^2 C-B c d+A d^2\right ) (a+b \tan (e+f x))^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))} \]
-(a^2*(c^2*C-2*B*c*d-C*d^2-A*(c^2-d^2))-b^2*(c^2*C-2*B*c*d-C*d^2-A*(c^2-d^ 2))-2*a*b*(2*c*(A-C)*d-B*(c^2-d^2)))*x/(c^2+d^2)^2+(2*a*b*(c^2*C-2*B*c*d-C *d^2-A*(c^2-d^2))+a^2*(2*c*(A-C)*d-B*(c^2-d^2))-b^2*(2*c*(A-C)*d-B*(c^2-d^ 2)))*ln(cos(f*x+e))/(c^2+d^2)^2/f-(-a*d+b*c)*(b*(2*A*d^4-B*c^3*d-3*B*c*d^3 +2*C*c^4+4*C*c^2*d^2)+a*d^2*(2*c*(A-C)*d-B*(c^2-d^2)))*ln(c+d*tan(f*x+e))/ d^3/(c^2+d^2)^2/f+b^2*(2*c^2*C-B*c*d+(A+C)*d^2)*tan(f*x+e)/d^2/(c^2+d^2)/f -(A*d^2-B*c*d+C*c^2)*(a+b*tan(f*x+e))^2/d/(c^2+d^2)/f/(c+d*tan(f*x+e))
Result contains complex when optimal does not.
Time = 5.57 (sec) , antiderivative size = 277, normalized size of antiderivative = 0.66 \[ \int \frac {(a+b \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\frac {\frac {(a+i b)^2 (-i A+B+i C) \log (i-\tan (e+f x))}{(c+i d)^2}+\frac {(a-i b)^2 (i A+B-i C) \log (i+\tan (e+f x))}{(c-i d)^2}+\frac {2 (-b c+a d) \left (b \left (2 c^4 C-B c^3 d+4 c^2 C d^2-3 B c d^3+2 A d^4\right )+a d^2 \left (2 c (A-C) d+B \left (-c^2+d^2\right )\right )\right ) \log (c+d \tan (e+f x))}{d^3 \left (c^2+d^2\right )^2}-\frac {2 (b c-a d)^2 \left (2 c^2 C-B c d+(A+C) d^2\right )}{d^3 \left (c^2+d^2\right ) (c+d \tan (e+f x))}+\frac {2 C (a+b \tan (e+f x))^2}{d (c+d \tan (e+f x))}}{2 f} \]
Integrate[((a + b*Tan[e + f*x])^2*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2)) /(c + d*Tan[e + f*x])^2,x]
(((a + I*b)^2*((-I)*A + B + I*C)*Log[I - Tan[e + f*x]])/(c + I*d)^2 + ((a - I*b)^2*(I*A + B - I*C)*Log[I + Tan[e + f*x]])/(c - I*d)^2 + (2*(-(b*c) + a*d)*(b*(2*c^4*C - B*c^3*d + 4*c^2*C*d^2 - 3*B*c*d^3 + 2*A*d^4) + a*d^2*( 2*c*(A - C)*d + B*(-c^2 + d^2)))*Log[c + d*Tan[e + f*x]])/(d^3*(c^2 + d^2) ^2) - (2*(b*c - a*d)^2*(2*c^2*C - B*c*d + (A + C)*d^2))/(d^3*(c^2 + d^2)*( c + d*Tan[e + f*x])) + (2*C*(a + b*Tan[e + f*x])^2)/(d*(c + d*Tan[e + f*x] )))/(2*f)
Time = 1.94 (sec) , antiderivative size = 433, normalized size of antiderivative = 1.04, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.222, Rules used = {3042, 4128, 3042, 4120, 3042, 4109, 3042, 3956, 4100, 16}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {(a+b \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {(a+b \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan (e+f x)^2\right )}{(c+d \tan (e+f x))^2}dx\) |
\(\Big \downarrow \) 4128 |
\(\displaystyle \frac {\int \frac {(a+b \tan (e+f x)) \left (b \left (2 C c^2-B d c+(A+C) d^2\right ) \tan ^2(e+f x)+d ((A-C) (b c-a d)+B (a c+b d)) \tan (e+f x)+A d (a c+2 b d)+(2 b c-a d) (c C-B d)\right )}{c+d \tan (e+f x)}dx}{d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {(a+b \tan (e+f x)) \left (b \left (2 C c^2-B d c+(A+C) d^2\right ) \tan (e+f x)^2+d ((A-C) (b c-a d)+B (a c+b d)) \tan (e+f x)+A d (a c+2 b d)+(2 b c-a d) (c C-B d)\right )}{c+d \tan (e+f x)}dx}{d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 4120 |
\(\displaystyle \frac {\frac {b^2 \tan (e+f x) \left (d^2 (A+C)-B c d+2 c^2 C\right )}{d f}-\frac {\int \frac {c \left (2 C c^2-B d c+(A+C) d^2\right ) b^2+(2 b c C-2 a d C-b B d) \left (c^2+d^2\right ) \tan ^2(e+f x) b-a d (A d (a c+2 b d)+(2 b c-a d) (c C-B d))-d^2 \left ((B c-(A-C) d) a^2+2 b (A c-C c+B d) a-b^2 (B c-(A-C) d)\right ) \tan (e+f x)}{c+d \tan (e+f x)}dx}{d}}{d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {b^2 \tan (e+f x) \left (d^2 (A+C)-B c d+2 c^2 C\right )}{d f}-\frac {\int \frac {c \left (2 C c^2-B d c+(A+C) d^2\right ) b^2+(2 b c C-2 a d C-b B d) \left (c^2+d^2\right ) \tan (e+f x)^2 b-a d (A d (a c+2 b d)+(2 b c-a d) (c C-B d))-d^2 \left ((B c-(A-C) d) a^2+2 b (A c-C c+B d) a-b^2 (B c-(A-C) d)\right ) \tan (e+f x)}{c+d \tan (e+f x)}dx}{d}}{d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 4109 |
\(\displaystyle \frac {\frac {b^2 \tan (e+f x) \left (d^2 (A+C)-B c d+2 c^2 C\right )}{d f}-\frac {\frac {d^2 \left (a^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+2 a b \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right ) \int \tan (e+f x)dx}{c^2+d^2}+\frac {(b c-a d) \left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (2 A d^4-B c^3 d-3 B c d^3+2 c^4 C+4 c^2 C d^2\right )\right ) \int \frac {\tan ^2(e+f x)+1}{c+d \tan (e+f x)}dx}{c^2+d^2}+\frac {d^2 x \left (a^2 \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-2 a b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )-b^2 \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )\right )}{c^2+d^2}}{d}}{d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {b^2 \tan (e+f x) \left (d^2 (A+C)-B c d+2 c^2 C\right )}{d f}-\frac {\frac {d^2 \left (a^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+2 a b \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right ) \int \tan (e+f x)dx}{c^2+d^2}+\frac {(b c-a d) \left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (2 A d^4-B c^3 d-3 B c d^3+2 c^4 C+4 c^2 C d^2\right )\right ) \int \frac {\tan (e+f x)^2+1}{c+d \tan (e+f x)}dx}{c^2+d^2}+\frac {d^2 x \left (a^2 \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-2 a b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )-b^2 \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )\right )}{c^2+d^2}}{d}}{d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle \frac {\frac {b^2 \tan (e+f x) \left (d^2 (A+C)-B c d+2 c^2 C\right )}{d f}-\frac {\frac {(b c-a d) \left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (2 A d^4-B c^3 d-3 B c d^3+2 c^4 C+4 c^2 C d^2\right )\right ) \int \frac {\tan (e+f x)^2+1}{c+d \tan (e+f x)}dx}{c^2+d^2}-\frac {d^2 \log (\cos (e+f x)) \left (a^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+2 a b \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{f \left (c^2+d^2\right )}+\frac {d^2 x \left (a^2 \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-2 a b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )-b^2 \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )\right )}{c^2+d^2}}{d}}{d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 4100 |
\(\displaystyle \frac {\frac {b^2 \tan (e+f x) \left (d^2 (A+C)-B c d+2 c^2 C\right )}{d f}-\frac {\frac {(b c-a d) \left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (2 A d^4-B c^3 d-3 B c d^3+2 c^4 C+4 c^2 C d^2\right )\right ) \int \frac {1}{c+d \tan (e+f x)}d(d \tan (e+f x))}{d f \left (c^2+d^2\right )}-\frac {d^2 \log (\cos (e+f x)) \left (a^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+2 a b \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{f \left (c^2+d^2\right )}+\frac {d^2 x \left (a^2 \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-2 a b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )-b^2 \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )\right )}{c^2+d^2}}{d}}{d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 16 |
\(\displaystyle \frac {\frac {b^2 \tan (e+f x) \left (d^2 (A+C)-B c d+2 c^2 C\right )}{d f}-\frac {-\frac {d^2 \log (\cos (e+f x)) \left (a^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+2 a b \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{f \left (c^2+d^2\right )}+\frac {d^2 x \left (a^2 \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-2 a b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )-b^2 \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )\right )}{c^2+d^2}+\frac {(b c-a d) \left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (2 A d^4-B c^3 d-3 B c d^3+2 c^4 C+4 c^2 C d^2\right )\right ) \log (c+d \tan (e+f x))}{d f \left (c^2+d^2\right )}}{d}}{d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
Int[((a + b*Tan[e + f*x])^2*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x])^2,x]
-(((c^2*C - B*c*d + A*d^2)*(a + b*Tan[e + f*x])^2)/(d*(c^2 + d^2)*f*(c + d *Tan[e + f*x]))) + (-(((d^2*(a^2*(c^2*C - 2*B*c*d - C*d^2 - A*(c^2 - d^2)) - b^2*(c^2*C - 2*B*c*d - C*d^2 - A*(c^2 - d^2)) - 2*a*b*(2*c*(A - C)*d - B*(c^2 - d^2)))*x)/(c^2 + d^2) - (d^2*(2*a*b*(c^2*C - 2*B*c*d - C*d^2 - A* (c^2 - d^2)) + a^2*(2*c*(A - C)*d - B*(c^2 - d^2)) - b^2*(2*c*(A - C)*d - B*(c^2 - d^2)))*Log[Cos[e + f*x]])/((c^2 + d^2)*f) + ((b*c - a*d)*(b*(2*c^ 4*C - B*c^3*d + 4*c^2*C*d^2 - 3*B*c*d^3 + 2*A*d^4) + a*d^2*(2*c*(A - C)*d - B*(c^2 - d^2)))*Log[c + d*Tan[e + f*x]])/(d*(c^2 + d^2)*f))/d) + (b^2*(2 *c^2*C - B*c*d + (A + C)*d^2)*Tan[e + f*x])/(d*f))/(d*(c^2 + d^2))
3.1.78.3.1 Defintions of rubi rules used
Int[(c_.)/((a_.) + (b_.)*(x_)), x_Symbol] :> Simp[c*(Log[RemoveContent[a + b*x, x]]/b), x] /; FreeQ[{a, b, c}, x]
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d *x], x]]/d, x] /; FreeQ[{c, d}, x]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[A/(b*f) Subst[Int[(a + x)^m, x], x, b* Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]
Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2 )/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*A + b*B - a *C)*(x/(a^2 + b^2)), x] + (Simp[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2) Int[( 1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Simp[(A*b - a*B - b*C)/( a^2 + b^2) Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] & & NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a*B - b*C , 0]
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) *(x_)])^(n_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f _.)*(x_)]^2), x_Symbol] :> Simp[b*C*Tan[e + f*x]*((c + d*Tan[e + f*x])^(n + 1)/(d*f*(n + 2))), x] - Simp[1/(d*(n + 2)) Int[(c + d*Tan[e + f*x])^n*Si mp[b*c*C - a*A*d*(n + 2) - (A*b + a*B - b*C)*d*(n + 2)*Tan[e + f*x] - (a*C* d*(n + 2) - b*(c*C - B*d*(n + 2)))*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[c^2 + d^2, 0] && !LtQ[n, -1]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(A*d^2 + c*(c*C - B*d))*(a + b*Tan[e + f*x])^m*((c + d*Tan[e + f*x])^(n + 1)/(d*f*(n + 1)*(c^2 + d^2))), x] - Sim p[1/(d*(n + 1)*(c^2 + d^2)) Int[(a + b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^(n + 1)*Simp[A*d*(b*d*m - a*c*(n + 1)) + (c*C - B*d)*(b*c*m + a*d* (n + 1)) - d*(n + 1)*((A - C)*(b*c - a*d) + B*(a*c + b*d))*Tan[e + f*x] - b *(d*(B*c - A*d)*(m + n + 1) - C*(c^2*m - d^2*(n + 1)))*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C}, x] && NeQ[b*c - a*d, 0] && NeQ [a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && GtQ[m, 0] && LtQ[n, -1]
Time = 0.27 (sec) , antiderivative size = 552, normalized size of antiderivative = 1.32
method | result | size |
derivativedivides | \(\frac {\frac {\tan \left (f x +e \right ) C \,b^{2}}{d^{2}}+\frac {\frac {\left (-2 A \,a^{2} c d +2 A a b \,c^{2}-2 A a b \,d^{2}+2 A \,b^{2} c d +B \,a^{2} c^{2}-B \,a^{2} d^{2}+4 B a b c d -B \,b^{2} c^{2}+B \,b^{2} d^{2}+2 C \,a^{2} c d -2 C a b \,c^{2}+2 C a b \,d^{2}-2 C \,b^{2} c d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (A \,a^{2} c^{2}-A \,a^{2} d^{2}+4 A a b c d -A \,b^{2} c^{2}+A \,b^{2} d^{2}+2 B \,a^{2} c d -2 B a b \,c^{2}+2 B a b \,d^{2}-2 B \,b^{2} c d -C \,a^{2} c^{2}+a^{2} C \,d^{2}-4 C a b c d +C \,b^{2} c^{2}-C \,b^{2} d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}-\frac {A \,a^{2} d^{4}-2 A a b c \,d^{3}+A \,b^{2} c^{2} d^{2}-B \,a^{2} c \,d^{3}+2 B a b \,c^{2} d^{2}-B \,b^{2} c^{3} d +C \,a^{2} c^{2} d^{2}-2 C a b \,c^{3} d +C \,b^{2} c^{4}}{d^{3} \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {\left (2 A \,a^{2} c \,d^{4}-2 A a b \,c^{2} d^{3}+2 A a b \,d^{5}-2 A \,b^{2} c \,d^{4}-B \,a^{2} c^{2} d^{3}+B \,a^{2} d^{5}-4 B a b c \,d^{4}+B \,b^{2} c^{4} d +3 B \,b^{2} c^{2} d^{3}-2 C \,a^{2} c \,d^{4}+2 C a b \,c^{4} d +6 C a b \,c^{2} d^{3}-2 C \,b^{2} c^{5}-4 C \,b^{2} c^{3} d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{3} \left (c^{2}+d^{2}\right )^{2}}}{f}\) | \(552\) |
default | \(\frac {\frac {\tan \left (f x +e \right ) C \,b^{2}}{d^{2}}+\frac {\frac {\left (-2 A \,a^{2} c d +2 A a b \,c^{2}-2 A a b \,d^{2}+2 A \,b^{2} c d +B \,a^{2} c^{2}-B \,a^{2} d^{2}+4 B a b c d -B \,b^{2} c^{2}+B \,b^{2} d^{2}+2 C \,a^{2} c d -2 C a b \,c^{2}+2 C a b \,d^{2}-2 C \,b^{2} c d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (A \,a^{2} c^{2}-A \,a^{2} d^{2}+4 A a b c d -A \,b^{2} c^{2}+A \,b^{2} d^{2}+2 B \,a^{2} c d -2 B a b \,c^{2}+2 B a b \,d^{2}-2 B \,b^{2} c d -C \,a^{2} c^{2}+a^{2} C \,d^{2}-4 C a b c d +C \,b^{2} c^{2}-C \,b^{2} d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}-\frac {A \,a^{2} d^{4}-2 A a b c \,d^{3}+A \,b^{2} c^{2} d^{2}-B \,a^{2} c \,d^{3}+2 B a b \,c^{2} d^{2}-B \,b^{2} c^{3} d +C \,a^{2} c^{2} d^{2}-2 C a b \,c^{3} d +C \,b^{2} c^{4}}{d^{3} \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {\left (2 A \,a^{2} c \,d^{4}-2 A a b \,c^{2} d^{3}+2 A a b \,d^{5}-2 A \,b^{2} c \,d^{4}-B \,a^{2} c^{2} d^{3}+B \,a^{2} d^{5}-4 B a b c \,d^{4}+B \,b^{2} c^{4} d +3 B \,b^{2} c^{2} d^{3}-2 C \,a^{2} c \,d^{4}+2 C a b \,c^{4} d +6 C a b \,c^{2} d^{3}-2 C \,b^{2} c^{5}-4 C \,b^{2} c^{3} d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{3} \left (c^{2}+d^{2}\right )^{2}}}{f}\) | \(552\) |
norman | \(\frac {\frac {c \left (A \,a^{2} c^{2}-A \,a^{2} d^{2}+4 A a b c d -A \,b^{2} c^{2}+A \,b^{2} d^{2}+2 B \,a^{2} c d -2 B a b \,c^{2}+2 B a b \,d^{2}-2 B \,b^{2} c d -C \,a^{2} c^{2}+a^{2} C \,d^{2}-4 C a b c d +C \,b^{2} c^{2}-C \,b^{2} d^{2}\right ) x}{c^{4}+2 c^{2} d^{2}+d^{4}}+\frac {C \,b^{2} \tan \left (f x +e \right )^{2}}{d f}+\frac {d \left (A \,a^{2} c^{2}-A \,a^{2} d^{2}+4 A a b c d -A \,b^{2} c^{2}+A \,b^{2} d^{2}+2 B \,a^{2} c d -2 B a b \,c^{2}+2 B a b \,d^{2}-2 B \,b^{2} c d -C \,a^{2} c^{2}+a^{2} C \,d^{2}-4 C a b c d +C \,b^{2} c^{2}-C \,b^{2} d^{2}\right ) x \tan \left (f x +e \right )}{c^{4}+2 c^{2} d^{2}+d^{4}}-\frac {A \,a^{2} d^{4}-2 A a b c \,d^{3}+A \,b^{2} c^{2} d^{2}-B \,a^{2} c \,d^{3}+2 B a b \,c^{2} d^{2}-B \,b^{2} c^{3} d +C \,a^{2} c^{2} d^{2}-2 C a b \,c^{3} d +2 C \,b^{2} c^{4}+C \,b^{2} c^{2} d^{2}}{f \,d^{3} \left (c^{2}+d^{2}\right )}}{c +d \tan \left (f x +e \right )}+\frac {\left (2 A \,a^{2} c \,d^{4}-2 A a b \,c^{2} d^{3}+2 A a b \,d^{5}-2 A \,b^{2} c \,d^{4}-B \,a^{2} c^{2} d^{3}+B \,a^{2} d^{5}-4 B a b c \,d^{4}+B \,b^{2} c^{4} d +3 B \,b^{2} c^{2} d^{3}-2 C \,a^{2} c \,d^{4}+2 C a b \,c^{4} d +6 C a b \,c^{2} d^{3}-2 C \,b^{2} c^{5}-4 C \,b^{2} c^{3} d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{4}+2 c^{2} d^{2}+d^{4}\right ) d^{3} f}-\frac {\left (2 A \,a^{2} c d -2 A a b \,c^{2}+2 A a b \,d^{2}-2 A \,b^{2} c d -B \,a^{2} c^{2}+B \,a^{2} d^{2}-4 B a b c d +B \,b^{2} c^{2}-B \,b^{2} d^{2}-2 C \,a^{2} c d +2 C a b \,c^{2}-2 C a b \,d^{2}+2 C \,b^{2} c d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}\) | \(743\) |
parallelrisch | \(\text {Expression too large to display}\) | \(2062\) |
risch | \(\text {Expression too large to display}\) | \(2406\) |
int((a+b*tan(f*x+e))^2*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^2, x,method=_RETURNVERBOSE)
1/f*(tan(f*x+e)*C*b^2/d^2+1/(c^2+d^2)^2*(1/2*(-2*A*a^2*c*d+2*A*a*b*c^2-2*A *a*b*d^2+2*A*b^2*c*d+B*a^2*c^2-B*a^2*d^2+4*B*a*b*c*d-B*b^2*c^2+B*b^2*d^2+2 *C*a^2*c*d-2*C*a*b*c^2+2*C*a*b*d^2-2*C*b^2*c*d)*ln(1+tan(f*x+e)^2)+(A*a^2* c^2-A*a^2*d^2+4*A*a*b*c*d-A*b^2*c^2+A*b^2*d^2+2*B*a^2*c*d-2*B*a*b*c^2+2*B* a*b*d^2-2*B*b^2*c*d-C*a^2*c^2+C*a^2*d^2-4*C*a*b*c*d+C*b^2*c^2-C*b^2*d^2)*a rctan(tan(f*x+e)))-1/d^3*(A*a^2*d^4-2*A*a*b*c*d^3+A*b^2*c^2*d^2-B*a^2*c*d^ 3+2*B*a*b*c^2*d^2-B*b^2*c^3*d+C*a^2*c^2*d^2-2*C*a*b*c^3*d+C*b^2*c^4)/(c^2+ d^2)/(c+d*tan(f*x+e))+1/d^3*(2*A*a^2*c*d^4-2*A*a*b*c^2*d^3+2*A*a*b*d^5-2*A *b^2*c*d^4-B*a^2*c^2*d^3+B*a^2*d^5-4*B*a*b*c*d^4+B*b^2*c^4*d+3*B*b^2*c^2*d ^3-2*C*a^2*c*d^4+2*C*a*b*c^4*d+6*C*a*b*c^2*d^3-2*C*b^2*c^5-4*C*b^2*c^3*d^2 )/(c^2+d^2)^2*ln(c+d*tan(f*x+e)))
Leaf count of result is larger than twice the leaf count of optimal. 939 vs. \(2 (417) = 834\).
Time = 0.56 (sec) , antiderivative size = 939, normalized size of antiderivative = 2.25 \[ \int \frac {(a+b \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=-\frac {2 \, C b^{2} c^{4} d^{2} + 2 \, A a^{2} d^{6} - 2 \, {\left (2 \, C a b + B b^{2}\right )} c^{3} d^{3} + 2 \, {\left (C a^{2} + 2 \, B a b + A b^{2}\right )} c^{2} d^{4} - 2 \, {\left (B a^{2} + 2 \, A a b\right )} c d^{5} - 2 \, {\left ({\left ({\left (A - C\right )} a^{2} - 2 \, B a b - {\left (A - C\right )} b^{2}\right )} c^{3} d^{3} + 2 \, {\left (B a^{2} + 2 \, {\left (A - C\right )} a b - B b^{2}\right )} c^{2} d^{4} - {\left ({\left (A - C\right )} a^{2} - 2 \, B a b - {\left (A - C\right )} b^{2}\right )} c d^{5}\right )} f x - 2 \, {\left (C b^{2} c^{4} d^{2} + 2 \, C b^{2} c^{2} d^{4} + C b^{2} d^{6}\right )} \tan \left (f x + e\right )^{2} + {\left (2 \, C b^{2} c^{6} + 4 \, C b^{2} c^{4} d^{2} - {\left (2 \, C a b + B b^{2}\right )} c^{5} d + {\left (B a^{2} + 2 \, {\left (A - 3 \, C\right )} a b - 3 \, B b^{2}\right )} c^{3} d^{3} - 2 \, {\left ({\left (A - C\right )} a^{2} - 2 \, B a b - A b^{2}\right )} c^{2} d^{4} - {\left (B a^{2} + 2 \, A a b\right )} c d^{5} + {\left (2 \, C b^{2} c^{5} d + 4 \, C b^{2} c^{3} d^{3} - {\left (2 \, C a b + B b^{2}\right )} c^{4} d^{2} + {\left (B a^{2} + 2 \, {\left (A - 3 \, C\right )} a b - 3 \, B b^{2}\right )} c^{2} d^{4} - 2 \, {\left ({\left (A - C\right )} a^{2} - 2 \, B a b - A b^{2}\right )} c d^{5} - {\left (B a^{2} + 2 \, A a b\right )} d^{6}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - {\left (2 \, C b^{2} c^{6} + 4 \, C b^{2} c^{4} d^{2} + 2 \, C b^{2} c^{2} d^{4} - {\left (2 \, C a b + B b^{2}\right )} c^{5} d - 2 \, {\left (2 \, C a b + B b^{2}\right )} c^{3} d^{3} - {\left (2 \, C a b + B b^{2}\right )} c d^{5} + {\left (2 \, C b^{2} c^{5} d + 4 \, C b^{2} c^{3} d^{3} + 2 \, C b^{2} c d^{5} - {\left (2 \, C a b + B b^{2}\right )} c^{4} d^{2} - 2 \, {\left (2 \, C a b + B b^{2}\right )} c^{2} d^{4} - {\left (2 \, C a b + B b^{2}\right )} d^{6}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \, {\left (2 \, C b^{2} c^{5} d - {\left (2 \, C a b + B b^{2}\right )} c^{4} d^{2} + {\left (C a^{2} + 2 \, B a b + {\left (A + 2 \, C\right )} b^{2}\right )} c^{3} d^{3} - {\left (B a^{2} + 2 \, A a b\right )} c^{2} d^{4} + {\left (A a^{2} + C b^{2}\right )} c d^{5} + {\left ({\left ({\left (A - C\right )} a^{2} - 2 \, B a b - {\left (A - C\right )} b^{2}\right )} c^{2} d^{4} + 2 \, {\left (B a^{2} + 2 \, {\left (A - C\right )} a b - B b^{2}\right )} c d^{5} - {\left ({\left (A - C\right )} a^{2} - 2 \, B a b - {\left (A - C\right )} b^{2}\right )} d^{6}\right )} f x\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left (c^{4} d^{4} + 2 \, c^{2} d^{6} + d^{8}\right )} f \tan \left (f x + e\right ) + {\left (c^{5} d^{3} + 2 \, c^{3} d^{5} + c d^{7}\right )} f\right )}} \]
integrate((a+b*tan(f*x+e))^2*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+ e))^2,x, algorithm="fricas")
-1/2*(2*C*b^2*c^4*d^2 + 2*A*a^2*d^6 - 2*(2*C*a*b + B*b^2)*c^3*d^3 + 2*(C*a ^2 + 2*B*a*b + A*b^2)*c^2*d^4 - 2*(B*a^2 + 2*A*a*b)*c*d^5 - 2*(((A - C)*a^ 2 - 2*B*a*b - (A - C)*b^2)*c^3*d^3 + 2*(B*a^2 + 2*(A - C)*a*b - B*b^2)*c^2 *d^4 - ((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*c*d^5)*f*x - 2*(C*b^2*c^4*d^2 + 2*C*b^2*c^2*d^4 + C*b^2*d^6)*tan(f*x + e)^2 + (2*C*b^2*c^6 + 4*C*b^2*c^ 4*d^2 - (2*C*a*b + B*b^2)*c^5*d + (B*a^2 + 2*(A - 3*C)*a*b - 3*B*b^2)*c^3* d^3 - 2*((A - C)*a^2 - 2*B*a*b - A*b^2)*c^2*d^4 - (B*a^2 + 2*A*a*b)*c*d^5 + (2*C*b^2*c^5*d + 4*C*b^2*c^3*d^3 - (2*C*a*b + B*b^2)*c^4*d^2 + (B*a^2 + 2*(A - 3*C)*a*b - 3*B*b^2)*c^2*d^4 - 2*((A - C)*a^2 - 2*B*a*b - A*b^2)*c*d ^5 - (B*a^2 + 2*A*a*b)*d^6)*tan(f*x + e))*log((d^2*tan(f*x + e)^2 + 2*c*d* tan(f*x + e) + c^2)/(tan(f*x + e)^2 + 1)) - (2*C*b^2*c^6 + 4*C*b^2*c^4*d^2 + 2*C*b^2*c^2*d^4 - (2*C*a*b + B*b^2)*c^5*d - 2*(2*C*a*b + B*b^2)*c^3*d^3 - (2*C*a*b + B*b^2)*c*d^5 + (2*C*b^2*c^5*d + 4*C*b^2*c^3*d^3 + 2*C*b^2*c* d^5 - (2*C*a*b + B*b^2)*c^4*d^2 - 2*(2*C*a*b + B*b^2)*c^2*d^4 - (2*C*a*b + B*b^2)*d^6)*tan(f*x + e))*log(1/(tan(f*x + e)^2 + 1)) - 2*(2*C*b^2*c^5*d - (2*C*a*b + B*b^2)*c^4*d^2 + (C*a^2 + 2*B*a*b + (A + 2*C)*b^2)*c^3*d^3 - (B*a^2 + 2*A*a*b)*c^2*d^4 + (A*a^2 + C*b^2)*c*d^5 + (((A - C)*a^2 - 2*B*a* b - (A - C)*b^2)*c^2*d^4 + 2*(B*a^2 + 2*(A - C)*a*b - B*b^2)*c*d^5 - ((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*d^6)*f*x)*tan(f*x + e))/((c^4*d^4 + 2*c^2 *d^6 + d^8)*f*tan(f*x + e) + (c^5*d^3 + 2*c^3*d^5 + c*d^7)*f)
Result contains complex when optimal does not.
Time = 3.01 (sec) , antiderivative size = 16225, normalized size of antiderivative = 38.91 \[ \int \frac {(a+b \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\text {Too large to display} \]
Piecewise((zoo*x*(a + b*tan(e))**2*(A + B*tan(e) + C*tan(e)**2)/tan(e)**2, Eq(c, 0) & Eq(d, 0) & Eq(f, 0)), ((A*a**2*x + A*a*b*log(tan(e + f*x)**2 + 1)/f - A*b**2*x + A*b**2*tan(e + f*x)/f + B*a**2*log(tan(e + f*x)**2 + 1) /(2*f) - 2*B*a*b*x + 2*B*a*b*tan(e + f*x)/f - B*b**2*log(tan(e + f*x)**2 + 1)/(2*f) + B*b**2*tan(e + f*x)**2/(2*f) - C*a**2*x + C*a**2*tan(e + f*x)/ f - C*a*b*log(tan(e + f*x)**2 + 1)/f + C*a*b*tan(e + f*x)**2/f + C*b**2*x + C*b**2*tan(e + f*x)**3/(3*f) - C*b**2*tan(e + f*x)/f)/c**2, Eq(d, 0)), ( -A*a**2*f*x*tan(e + f*x)**2/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 2*I*A*a**2*f*x*tan(e + f*x)/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + A*a**2*f*x/(4*d**2*f*tan(e + f*x)* *2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) - A*a**2*tan(e + f*x)/(4*d**2*f*t an(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 2*I*A*a**2/(4*d**2* f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 2*I*A*a*b*f*x*ta n(e + f*x)**2/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2 *f) + 4*A*a*b*f*x*tan(e + f*x)/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan( e + f*x) - 4*d**2*f) - 2*I*A*a*b*f*x/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2* f*tan(e + f*x) - 4*d**2*f) + 2*I*A*a*b*tan(e + f*x)/(4*d**2*f*tan(e + f*x) **2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + A*b**2*f*x*tan(e + f*x)**2/(4* d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) - 2*I*A*b**2* f*x*tan(e + f*x)/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - ...
Time = 0.34 (sec) , antiderivative size = 493, normalized size of antiderivative = 1.18 \[ \int \frac {(a+b \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\frac {\frac {2 \, C b^{2} \tan \left (f x + e\right )}{d^{2}} + \frac {2 \, {\left ({\left ({\left (A - C\right )} a^{2} - 2 \, B a b - {\left (A - C\right )} b^{2}\right )} c^{2} + 2 \, {\left (B a^{2} + 2 \, {\left (A - C\right )} a b - B b^{2}\right )} c d - {\left ({\left (A - C\right )} a^{2} - 2 \, B a b - {\left (A - C\right )} b^{2}\right )} d^{2}\right )} {\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} - \frac {2 \, {\left (2 \, C b^{2} c^{5} + 4 \, C b^{2} c^{3} d^{2} - {\left (2 \, C a b + B b^{2}\right )} c^{4} d + {\left (B a^{2} + 2 \, {\left (A - 3 \, C\right )} a b - 3 \, B b^{2}\right )} c^{2} d^{3} - 2 \, {\left ({\left (A - C\right )} a^{2} - 2 \, B a b - A b^{2}\right )} c d^{4} - {\left (B a^{2} + 2 \, A a b\right )} d^{5}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}} + \frac {{\left ({\left (B a^{2} + 2 \, {\left (A - C\right )} a b - B b^{2}\right )} c^{2} - 2 \, {\left ({\left (A - C\right )} a^{2} - 2 \, B a b - {\left (A - C\right )} b^{2}\right )} c d - {\left (B a^{2} + 2 \, {\left (A - C\right )} a b - B b^{2}\right )} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} - \frac {2 \, {\left (C b^{2} c^{4} + A a^{2} d^{4} - {\left (2 \, C a b + B b^{2}\right )} c^{3} d + {\left (C a^{2} + 2 \, B a b + A b^{2}\right )} c^{2} d^{2} - {\left (B a^{2} + 2 \, A a b\right )} c d^{3}\right )}}{c^{3} d^{3} + c d^{5} + {\left (c^{2} d^{4} + d^{6}\right )} \tan \left (f x + e\right )}}{2 \, f} \]
integrate((a+b*tan(f*x+e))^2*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+ e))^2,x, algorithm="maxima")
1/2*(2*C*b^2*tan(f*x + e)/d^2 + 2*(((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*c ^2 + 2*(B*a^2 + 2*(A - C)*a*b - B*b^2)*c*d - ((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*d^2)*(f*x + e)/(c^4 + 2*c^2*d^2 + d^4) - 2*(2*C*b^2*c^5 + 4*C*b^2 *c^3*d^2 - (2*C*a*b + B*b^2)*c^4*d + (B*a^2 + 2*(A - 3*C)*a*b - 3*B*b^2)*c ^2*d^3 - 2*((A - C)*a^2 - 2*B*a*b - A*b^2)*c*d^4 - (B*a^2 + 2*A*a*b)*d^5)* log(d*tan(f*x + e) + c)/(c^4*d^3 + 2*c^2*d^5 + d^7) + ((B*a^2 + 2*(A - C)* a*b - B*b^2)*c^2 - 2*((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*c*d - (B*a^2 + 2*(A - C)*a*b - B*b^2)*d^2)*log(tan(f*x + e)^2 + 1)/(c^4 + 2*c^2*d^2 + d^4 ) - 2*(C*b^2*c^4 + A*a^2*d^4 - (2*C*a*b + B*b^2)*c^3*d + (C*a^2 + 2*B*a*b + A*b^2)*c^2*d^2 - (B*a^2 + 2*A*a*b)*c*d^3)/(c^3*d^3 + c*d^5 + (c^2*d^4 + d^6)*tan(f*x + e)))/f
Leaf count of result is larger than twice the leaf count of optimal. 893 vs. \(2 (417) = 834\).
Time = 0.78 (sec) , antiderivative size = 893, normalized size of antiderivative = 2.14 \[ \int \frac {(a+b \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\frac {\frac {2 \, C b^{2} \tan \left (f x + e\right )}{d^{2}} + \frac {2 \, {\left (A a^{2} c^{2} - C a^{2} c^{2} - 2 \, B a b c^{2} - A b^{2} c^{2} + C b^{2} c^{2} + 2 \, B a^{2} c d + 4 \, A a b c d - 4 \, C a b c d - 2 \, B b^{2} c d - A a^{2} d^{2} + C a^{2} d^{2} + 2 \, B a b d^{2} + A b^{2} d^{2} - C b^{2} d^{2}\right )} {\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac {{\left (B a^{2} c^{2} + 2 \, A a b c^{2} - 2 \, C a b c^{2} - B b^{2} c^{2} - 2 \, A a^{2} c d + 2 \, C a^{2} c d + 4 \, B a b c d + 2 \, A b^{2} c d - 2 \, C b^{2} c d - B a^{2} d^{2} - 2 \, A a b d^{2} + 2 \, C a b d^{2} + B b^{2} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} - \frac {2 \, {\left (2 \, C b^{2} c^{5} - 2 \, C a b c^{4} d - B b^{2} c^{4} d + 4 \, C b^{2} c^{3} d^{2} + B a^{2} c^{2} d^{3} + 2 \, A a b c^{2} d^{3} - 6 \, C a b c^{2} d^{3} - 3 \, B b^{2} c^{2} d^{3} - 2 \, A a^{2} c d^{4} + 2 \, C a^{2} c d^{4} + 4 \, B a b c d^{4} + 2 \, A b^{2} c d^{4} - B a^{2} d^{5} - 2 \, A a b d^{5}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}} + \frac {2 \, {\left (2 \, C b^{2} c^{5} d \tan \left (f x + e\right ) - 2 \, C a b c^{4} d^{2} \tan \left (f x + e\right ) - B b^{2} c^{4} d^{2} \tan \left (f x + e\right ) + 4 \, C b^{2} c^{3} d^{3} \tan \left (f x + e\right ) + B a^{2} c^{2} d^{4} \tan \left (f x + e\right ) + 2 \, A a b c^{2} d^{4} \tan \left (f x + e\right ) - 6 \, C a b c^{2} d^{4} \tan \left (f x + e\right ) - 3 \, B b^{2} c^{2} d^{4} \tan \left (f x + e\right ) - 2 \, A a^{2} c d^{5} \tan \left (f x + e\right ) + 2 \, C a^{2} c d^{5} \tan \left (f x + e\right ) + 4 \, B a b c d^{5} \tan \left (f x + e\right ) + 2 \, A b^{2} c d^{5} \tan \left (f x + e\right ) - B a^{2} d^{6} \tan \left (f x + e\right ) - 2 \, A a b d^{6} \tan \left (f x + e\right ) + C b^{2} c^{6} - C a^{2} c^{4} d^{2} - 2 \, B a b c^{4} d^{2} - A b^{2} c^{4} d^{2} + 3 \, C b^{2} c^{4} d^{2} + 2 \, B a^{2} c^{3} d^{3} + 4 \, A a b c^{3} d^{3} - 4 \, C a b c^{3} d^{3} - 2 \, B b^{2} c^{3} d^{3} - 3 \, A a^{2} c^{2} d^{4} + C a^{2} c^{2} d^{4} + 2 \, B a b c^{2} d^{4} + A b^{2} c^{2} d^{4} - A a^{2} d^{6}\right )}}{{\left (c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}\right )} {\left (d \tan \left (f x + e\right ) + c\right )}}}{2 \, f} \]
integrate((a+b*tan(f*x+e))^2*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+ e))^2,x, algorithm="giac")
1/2*(2*C*b^2*tan(f*x + e)/d^2 + 2*(A*a^2*c^2 - C*a^2*c^2 - 2*B*a*b*c^2 - A *b^2*c^2 + C*b^2*c^2 + 2*B*a^2*c*d + 4*A*a*b*c*d - 4*C*a*b*c*d - 2*B*b^2*c *d - A*a^2*d^2 + C*a^2*d^2 + 2*B*a*b*d^2 + A*b^2*d^2 - C*b^2*d^2)*(f*x + e )/(c^4 + 2*c^2*d^2 + d^4) + (B*a^2*c^2 + 2*A*a*b*c^2 - 2*C*a*b*c^2 - B*b^2 *c^2 - 2*A*a^2*c*d + 2*C*a^2*c*d + 4*B*a*b*c*d + 2*A*b^2*c*d - 2*C*b^2*c*d - B*a^2*d^2 - 2*A*a*b*d^2 + 2*C*a*b*d^2 + B*b^2*d^2)*log(tan(f*x + e)^2 + 1)/(c^4 + 2*c^2*d^2 + d^4) - 2*(2*C*b^2*c^5 - 2*C*a*b*c^4*d - B*b^2*c^4*d + 4*C*b^2*c^3*d^2 + B*a^2*c^2*d^3 + 2*A*a*b*c^2*d^3 - 6*C*a*b*c^2*d^3 - 3 *B*b^2*c^2*d^3 - 2*A*a^2*c*d^4 + 2*C*a^2*c*d^4 + 4*B*a*b*c*d^4 + 2*A*b^2*c *d^4 - B*a^2*d^5 - 2*A*a*b*d^5)*log(abs(d*tan(f*x + e) + c))/(c^4*d^3 + 2* c^2*d^5 + d^7) + 2*(2*C*b^2*c^5*d*tan(f*x + e) - 2*C*a*b*c^4*d^2*tan(f*x + e) - B*b^2*c^4*d^2*tan(f*x + e) + 4*C*b^2*c^3*d^3*tan(f*x + e) + B*a^2*c^ 2*d^4*tan(f*x + e) + 2*A*a*b*c^2*d^4*tan(f*x + e) - 6*C*a*b*c^2*d^4*tan(f* x + e) - 3*B*b^2*c^2*d^4*tan(f*x + e) - 2*A*a^2*c*d^5*tan(f*x + e) + 2*C*a ^2*c*d^5*tan(f*x + e) + 4*B*a*b*c*d^5*tan(f*x + e) + 2*A*b^2*c*d^5*tan(f*x + e) - B*a^2*d^6*tan(f*x + e) - 2*A*a*b*d^6*tan(f*x + e) + C*b^2*c^6 - C* a^2*c^4*d^2 - 2*B*a*b*c^4*d^2 - A*b^2*c^4*d^2 + 3*C*b^2*c^4*d^2 + 2*B*a^2* c^3*d^3 + 4*A*a*b*c^3*d^3 - 4*C*a*b*c^3*d^3 - 2*B*b^2*c^3*d^3 - 3*A*a^2*c^ 2*d^4 + C*a^2*c^2*d^4 + 2*B*a*b*c^2*d^4 + A*b^2*c^2*d^4 - A*a^2*d^6)/((c^4 *d^3 + 2*c^2*d^5 + d^7)*(d*tan(f*x + e) + c)))/f
Time = 33.60 (sec) , antiderivative size = 3958, normalized size of antiderivative = 9.49 \[ \int \frac {(a+b \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\text {Too large to display} \]
int(((a + b*tan(e + f*x))^2*(A + B*tan(e + f*x) + C*tan(e + f*x)^2))/(c + d*tan(e + f*x))^2,x)
(log((2*C^2*b^4*c^5 - 2*C^2*a^2*b^2*c^5 + 4*C^2*b^4*c^3*d^2 - A*B*a^4*d^5 - 2*A*C*b^4*c^5 + B*C*a^4*d^5 + 2*A^2*a*b^3*d^5 - 2*A^2*a^3*b*d^5 - A^2*a^ 4*c*d^4 + 2*B^2*a^3*b*d^5 - A^2*b^4*c*d^4 + B^2*a^4*c*d^4 + B^2*b^4*c*d^4 - C^2*a^4*c*d^4 + C^2*b^4*c*d^4 - 4*C^2*a^2*b^2*c^3*d^2 + 5*A*B*a^2*b^2*d^ 5 + 2*A*C*a^2*b^2*c^5 + A*B*a^4*c^2*d^3 + 3*A*B*b^4*c^2*d^3 - B*C*a^2*b^2* d^5 - 4*A*C*b^4*c^3*d^2 - B*C*a^4*c^2*d^3 - 3*B*C*b^4*c^2*d^3 + 2*B^2*a*b^ 3*c^4*d - 2*C^2*a*b^3*c^4*d + 2*C^2*a^3*b*c^4*d - 2*A^2*a*b^3*c^2*d^3 + 6* A^2*a^2*b^2*c*d^4 + 2*A^2*a^3*b*c^2*d^3 + 6*B^2*a*b^3*c^2*d^3 - 6*B^2*a^2* b^2*c*d^4 - 2*B^2*a^3*b*c^2*d^3 - 6*C^2*a*b^3*c^2*d^3 + 4*C^2*a^2*b^2*c*d^ 4 + 6*C^2*a^3*b*c^2*d^3 - 2*A*C*a*b^3*d^5 + 2*A*C*a^3*b*d^5 - 4*B*C*a*b^3* c^5 + A*B*b^4*c^4*d + 2*A*C*a^4*c*d^4 - B*C*b^4*c^4*d - 8*A*B*a*b^3*c*d^4 + 8*A*B*a^3*b*c*d^4 + 2*A*C*a*b^3*c^4*d - 2*A*C*a^3*b*c^4*d + 4*B*C*a*b^3* c*d^4 - 8*B*C*a^3*b*c*d^4 - A*B*a^2*b^2*c^4*d + 8*A*C*a*b^3*c^2*d^3 - 10*A *C*a^2*b^2*c*d^4 - 8*A*C*a^3*b*c^2*d^3 - 8*B*C*a*b^3*c^3*d^2 + 5*B*C*a^2*b ^2*c^4*d - 8*A*B*a^2*b^2*c^2*d^3 + 4*A*C*a^2*b^2*c^3*d^2 + 16*B*C*a^2*b^2* c^2*d^3)/(d^2*(c^2 + d^2)^2) + ((a*1i - b)^2*((A*b^2*d^2 - A*a^2*d^2 + C*a ^2*d^2 - 8*C*b^2*c^2 - C*b^2*d^2 + 2*B*a*b*d^2 + 4*B*b^2*c*d + 8*C*a*b*c*d )/d - (tan(e + f*x)*(3*B*a^2*d^5 - 5*B*b^2*d^5 - 4*C*b^2*c^5 + 6*A*a*b*d^5 - 10*C*a*b*d^5 + 4*A*a^2*c*d^4 - 4*A*b^2*c*d^4 + 2*B*b^2*c^4*d - 4*C*a^2* c*d^4 + 8*C*b^2*c*d^4 - B*a^2*c^2*d^3 + B*b^2*c^2*d^3 - 8*B*a*b*c*d^4 +...